home *** CD-ROM | disk | FTP | other *** search
/ The Arsenal Files 4 / The Arsenal Files 4 (Arsenal Computer).ISO / casm / au116-as.exe / UTIL / RENSTRIC.CPP < prev    next >
C/C++ Source or Header  |  1993-12-05  |  1KB  |  43 lines

  1. #include "..\au.hpp"
  2. /*************************************************************************/
  3.  
  4. static char orig[FILE_SIZE];
  5.  
  6. /*░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░*/
  7. int rename_strict(AU *au, PACKAGE *p, char *source_directory, char *file_name)
  8. {
  9.     char string1[FLENGTH];
  10.     char string2[FLENGTH];
  11.     char ext[5];
  12.  
  13.     if (au->simulate)
  14.         return FALSE;
  15.  
  16.     sprintf(ext, ".%s", p->extension);
  17.     if (p->strict_ext == ON && !strstr(file_name, ext))
  18.     {
  19.         sprintf(ext, "*.%s", p->extension);
  20.         strcpy(orig, file_name);
  21.         strcpy(file_name, fit_mask(file_name, ext));
  22.         build_fname(string1, source_directory, orig);
  23.         build_fname(string2, source_directory, file_name);
  24.         rename(string1, string2);
  25.         return TRUE;
  26.     }
  27.  
  28.     return FALSE;
  29. }
  30. /*░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░*/
  31. int rename_strict_back(char *source_directory, char *file_name)
  32. {
  33.     char string1[FLENGTH];
  34.     char string2[FLENGTH];
  35.  
  36.     build_fname(string1, source_directory, file_name);
  37.     build_fname(string2, source_directory, orig);
  38.     rename(string1, string2);
  39.     strcpy(file_name, orig);
  40.     return 0;
  41. }
  42.  
  43.